package com.xg.java.service;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Service
public class ErrorService {
    protected final Log logger = LogFactory.getLog(ErrorService.class);

    public void fail(HttpServletRequest request, HttpServletResponse response, String msg) throws ServletException, IOException {
        logger.warn(msg);
        request.setAttribute("msg",msg);
        request.getRequestDispatcher("/expiredJwtException").forward(request, response);
    }
}
